int npages)
{
+ int saved_errno = errno;
/* Unlock pages */
munlock(ptr, npages * XC_PAGE_SIZE);
munmap(ptr, npages * XC_PAGE_SIZE);
+ /* We MUST propagate the hypercall errno, not unmap call's. */
+ errno = saved_errno;
}
static int freebsd_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h,
static void hypercall_buffer_cache_lock(xc_interface *xch)
{
+ int saved_errno = errno;
if ( xch->flags & XC_OPENFLAG_NON_REENTRANT )
return;
pthread_mutex_lock(&hypercall_buffer_cache_mutex);
+ /* Ignore pthread errors. */
+ errno = saved_errno;
}
static void hypercall_buffer_cache_unlock(xc_interface *xch)
{
+ int saved_errno = errno;
if ( xch->flags & XC_OPENFLAG_NON_REENTRANT )
return;
pthread_mutex_unlock(&hypercall_buffer_cache_mutex);
+ /* Ignore pthread errors. */
+ errno = saved_errno;
}
static void *hypercall_buffer_cache_alloc(xc_interface *xch, int nr_pages)
static void linux_privcmd_free_hypercall_buffer(xc_interface *xch, xc_osdep_handle h, void *ptr, int npages)
{
+ int saved_errno = errno;
/* Recover the VMA flags. Maybe it's not necessary */
madvise(ptr, npages * XC_PAGE_SIZE, MADV_DOFORK);
munmap(ptr, npages * XC_PAGE_SIZE);
+ /* We MUST propagate the hypercall errno, not unmap call's. */
+ errno = saved_errno;
}
static int linux_privcmd_hypercall(xc_interface *xch, xc_osdep_handle h, privcmd_hypercall_t *hypercall)